package com.etl.dataflow.executor.connectivity;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

public class DynamicDatasource {

    public static HikariDataSource getDataSources(String url, String username, String password) {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl(url);
        config.setUsername(username);
        config.setPassword(password);
        config.setMinimumIdle(1);
        config.setMaximumPoolSize(2);
        config.setAutoCommit(false);
        config.setIdleTimeout(60000L);
        config.setMaxLifetime(900000L);
        config.setConnectionTimeout(60000L);
        config.setValidationTimeout(3000L);
        config.setConnectionTestQuery("select 1 from dual");
        config.setRegisterMbeans(true);
        return new HikariDataSource(config);
    }

}
